<div class="wrapper clearfix">
	
	<?php $this->load->view('ucenter/sidebar');?>
	
	<div class="content">
		
		<h3>我的收藏</h3>
		
		<ul class="clearfix">
			
			<li class="image">图片</li>
			<li class="name">名称</li>
			<li class="price">价格</li>
			<li class="store">库存</li>
			<li class="date">收藏日期</li>
			<li class="doit">操作</li>

		</ul>
		
		<div class="lists">
		
		<?php if(!$user_bookmark):?>
        	<div class="alert alert-nobook"><img src="<?php echo base_url('static/images/duola-a-meng_06.png');?>" />您还没有任何收藏信息，<a href="<?php echo base_url("lists/index/1") ?>">现在就去收藏~</a></div>
        <?php endif;?>
        	
		<?php foreach ($user_bookmark as $markVal):?>
			<div class="item clearfix" id="bookmark_<?php echo $markVal->mark_id;?>">
				
				<li class="image"><a href="<?php echo base_url('lists/item/'.$markVal->book_id)?>" target="_blank"><img src="<?php echo base_url('uploads/thumb_50/'.$markVal->book_img)?>" height="35" /></a></li>
				<li class="name"><a href="<?php echo base_url('lists/item/'.$markVal->book_id)?>" target="_blank"><?php echo $markVal->book_name;?></a></li>
				<li class="price"><?php echo $markVal->book_price;?></li>
				<li class="store">
				<?php 
				if($markVal->book_store > 1 )
				{
					echo '现货';
				}
				else if($markVal->book_store < 1)
				{
					echo '<span class="label label-default">缺货</span>';
				}
				else 
				{
					echo '<span class="label label-danger">仅剩1件</span>';
				}
				?>
				</li>
				<li class="date"><?php echo date("Y-m-d H:i:s",$markVal->mark_time);?></li>
				<li class="doit"><a href="Javascript:;" onclick="confirmDel('<?php echo $markVal->mark_id;?>','<?php echo $markVal->book_name;?>','<?php echo $markVal->book_id;?>')">删除</a></li>
			
			</div>
		<?php endforeach;?>
		
		</div><!-- lists -->
	
	<div class="pagination"><?php echo $this->pagination->pagination(); ?></div>
	</div><!-- content -->

</div><!-- wrapper -->

<script>
	//取消订单
function confirmDel(mark_id,book_name,book_id){
	var myModal = new jBox('Confirm', {

		confirmButton:"我要取消收藏",
		cancelButton:"关闭窗口",
		content:"确认取消"+book_name+"的收藏？",
		confirm:function(){
			$.ajax({
				url:"<?php echo base_url('ucenter/deleteBookmark');?>",
				dataType:"json",
				type:"post",
				data:{"mark_id":mark_id,"book_id":book_id,},
				success:function(e){
					if(e.status=='10000'){
						$("#bookmark_"+mark_id).hide("slow");
						if(e.mark_amount=='0'){
							$(".lists").html('<div class="alert alert-nobook"><img src="<?php echo base_url('static/images/duola-a-meng_06.png');?>" />您还没有任何收藏信息，<a href="<?php echo base_url("lists/index/1") ?>">现在就去收藏~</a></div>');
						}
					}
				}
			});
		}
	});
	 
	myModal.open();
}
</script>